package labReport.experiment3;


import java.util.InputMismatchException;
import java.util.Scanner;

class Calculation {
    static int division(int a, int b) {
        return a / b;
    }
}

public class ArithmeticExceptionTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            System.out.print("a = ");
            int a = sc.nextInt();
            System.out.print("b = ");
            int b = sc.nextInt();
            System.out.println("a / b = " + Calculation.division(a, b));
        } catch (ArithmeticException e) {
            System.out.println("发生除0异常：" + e.getMessage());
            e.printStackTrace();
        } catch (InputMismatchException e){
            System.out.println("发生输入异常：" + e.getMessage());
            e.printStackTrace();
        }
    }
}
